#include "QxWellFileBase.hpp"

QxWellFileBase::QxWellFileBase( QObject* parent ) : QObject( parent ), QxWellDataIO()
{
}

QxWellFileBase::~QxWellFileBase()
{
}

QxWellInfoDefine QxWellFileBase::wellInfoDefine() const
{
  return m_wellInfoDefine;
}

void QxWellFileBase::setWellInfoDefine( const QxWellInfoDefine& wellInfoDefine )
{
  m_wellInfoDefine = wellInfoDefine;
}

QVector<QxWellLogDefine> QxWellFileBase::wellLogDefines() const
{
  return m_wellLogDefines;
}

bool QxWellFileBase::insertWellLogDefine( const QxWellLogDefine& wellLogDefine )
{
  if( !m_wellLogDefines.contains( wellLogDefine ) ) {
    m_wellLogDefines << wellLogDefine;
  }

  return true;
}

bool QxWellFileBase::removeWellLogDefine( const QxWellLogDefine& wellLogDefine )
{
  if( m_wellLogDefines.contains( wellLogDefine ) ) {
    m_wellLogDefines.remove( m_wellLogDefines.indexOf( wellLogDefine ) );
  }
  return true;
}

QStringList QxWellFileBase::queryWellLogNames()
{
  QStringList result;
  Q_FOREACH( const QxWellLogDefine& wellLogDefine, m_wellLogDefines ) {
    result << wellLogDefine.wellLogName;
  }

  return result;
}

void QxWellFileBase::clear()
{
  m_wellLogDefines.clear();
}

const QString& QxWellFileBase::filename() const
{
  return m_filename;
}

void QxWellFileBase::setFilename( const QString& filename )
{
  if( m_filename != filename ) {
    m_filename = filename;
    reload();
  }
}